<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>订单展示页</title>
	<script src='__PUBLIC__/Js/jquery.js'></script>
	<script src="//cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.js"></script>
	<link href="//cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.css" rel="stylesheet">
	<script src="__PUBLIC__/Js/Jqui/jquery-ui.min.js"></script>
	<script src="__PUBLIC__/Js/jqPaginator.js"></script>
	<style>
	*{margin:0;padding:0;}
	a{cursor:pointer;}
	.obody{width:1000px;margin:100px auto;border:0px solid black;}
	.ends{width:100%;height:50px;}
	.btn1{width:50px;height:30px;border:1px ;border-radius:2px;}
	.btn2{width:50px;height:30px;border:1px ;border-radius:2px;}
	.btn3{width:50px;height:30px;border:1px ;border-radius:2px;}
	.pok{background:red;width:100px;height:40px;color:white;font-size:15px;border:0px ;border-radius:4px;}
	.en{margin-left:650px;}
	hr{border:1px solid #D6D6D6;}
	</style>
</head>
<body>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~固定在头部的导航栏~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
	<div class="navbar-header">
		 <a class="navbar-brand">发货管理</a>
	</div>
</nav>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~展示的表格~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<div class="obody">
	<table id="showtable" class="table table-hover">
		<thead>
		<tr>
			<td>选择</td>
			<td>订单号</td>
			<td>会员账号</td>
			<td>收件人</td>
			<td>收货电话</td>
			<td>收货地址</td>			
			<td>下单时间</td>
		</tr>
		</thead>
		<foreach name="list" item='v'>
		<tr>
			<td><input type="checkbox" class="choo" name='row[]' value='<{$v.oid}>'></td>			
			<td><{$v.ordnum}></td>
			<td><{$v.user_name}></td>
			<td><{$v.ord_name}></td>
			<td><{$v.ord_tel}></td>
			<td><{$v.ord_addr}></td>
			<td><{$v.ordtime|date="Y-m-d H:i:s",###}></td>		
		</tr>
		</foreach>
	</table>
	<hr>
	<div class="ends">
		<input type="button" value="全选" class="btn1">
		<input type="button" value="不选" class="btn2">
		<input type="button" value="反选" class='btn3'>
		<span class="en"><input type="button" value="发货" class='pok'></span>
	</div>
</div>

<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~js代码部分~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<script>
//全选反选不选
$('.btn3').click(function(){
	$('input[name="row[]"]').map(function(k,v){
		var flag = $(v).prop('checked');
		$(v).prop('checked',!flag);
	});			
});
$('.btn1').click(function(){
	$('input[name="row[]"]').prop('checked',!$(this).prop('checked'))
		
});
$('.btn2').click(function(){
	$('input[name="row[]"]').prop('checked',$(this).prop('checked'))
		
});
$('.pok').click(function(){
	var arr=[];				
	if($('.choo').is(':checked')){
		$('.choo:checked').map(function(k,v){
		 	arr.push($(v).val());
		});
		$.post('<{:U("Admin/Order/dosend")}>',{arr:arr},function(data){
			if(data.status){
				$('.choo:checked').parent().parent().remove();
				alert('发货成功');
			}else{
				alert("发货失败");
			}
		});
	}else{
		alert('请先选择要发货的订单');
	}		
});




</script>
</body>
</html>